
{% extends "light.twig" %}
{% set concept_label = '' %}{% for concept in search_results %}{% set concept_label = concept.label %}{% endfor %}
{% block title %}{% if search_results|length == 1 %}: {{ vocab_id|upper }}: {{ concept_label }}{% else %}: {{ vocab_id|upper }}{% endif %}
{% endblock %}
{% block content %}
  {% if lang_changed %}
  <div class="alert alert-danger">
    <h4>{{ lang_changed }}</h4>
  </div>
  {% endif %}
  {% if vocab.title != null or search_results != null %}
  	{% if search_results %}
  	  {% if search_results|length > 1 %}
      <div class="search-count"><p>{{ search_count }} {% trans 'results' %}</p></div>
      {% endif %}
        {% for concept in search_results %} {# loop through the hits #}
        <div class="concept-info">
          <div class="concept-main">
          {% if bread_crumbs is defined %}
            {% for path in bread_crumbs %}
            {% if path|length > 1 %}
              {% set crumbId = loop.index %}
                <div class="crumb-path">
                {% for crumb in path %}
                {% if not loop.last %}<a class="propertyvalue bread-crumb{% if crumb.hiddenLabel %} expand-crumbs{% endif %}" href="{{ crumb.uri|link_url(vocab,lang) }}">{{ crumb.prefLabel }}</a><span class="bread-crumb"> > </span>
                {% else %}<span class="bread-crumb propertylabel-pink">{{ crumb.prefLabel }}</span>
                {% endif %}
                {% if crumb.hiddenLabel %}
                  {% for hiddenPath in combined %}
                    {% if crumbId == loop.index %}
                      {% for hiddenCrumb in hiddenPath %}
                      <a class="propertyvalue hidden-breadcrumb" href="{{ hiddenCrumb.uri|link_url(vocab,lang) }}">{{ hiddenCrumb.hiddenLabel }}</a><span class="hidden-breadcrumb"> > </span>
                      {% endfor %}
                    {% endif %}
                  {% endfor %}
                {% endif %}
                {% endfor %}
                </div>
              {% endif %}
            {% endfor %}
          {% endif %}
          {% spaceless %}
          <table class="preflabel-container">
            <td class="preflabel-description">
              <span class="versal" title="{{ 'skos:prefLabel_help'|trans }}">{{ 'skos:prefLabel'|trans|upper }}:</span>
            {% if concept.foundBy %} {# hit has been found through an alternative label #}
            <span class="versal">{{ concept.foundBy }} >></span>
            {% if concept.ExVocab is defined %}
            <span class="prefLabel conceptlabel redirected-vocab-id"> @{{ concept.ExVocab }}</span>
            {% endif %}
            <br /><a class="prefLabel foundby" href="{{ concept.uri | link_url(concept.vocab,lang) }}">{{ concept.label }}</a></span>
            </td>
          {% else %}
          <td>
          <span class="prefLabel
            {% if lang_count is not defined and rest != 1 %}">{{ concept.label }}</span>{% else %}"></span>
            <a class="prefLabel conceptlabel" href="{% if concept.type == "skos:Collection" %}{{ concept.uri | link_url(concept.vocab, lang, 'groups') }}{% elseif concept.exvocab is defined%}{{ concept.uri | link_url(concept.exvocab,concept.lang) }}{% else %}{{ concept.uri | link_url(concept.vocab,concept.lang) }}{% endif %}">{{ concept.label }}</a>
            {% endif %}
          </td>
          {% endif %}
          </table>
          <hr />
          {% endspaceless %}
          <table class="table search-results-property-table{% if concept.type == 'skosext:DeprecatedConcept' %} deprecated{% endif %}">
          {% if concept.type == 'skosext:DeprecatedConcept' %}<h2 class="deprecated-alert">{% trans %}deprecated{% endtrans %}</h2>{% endif %}
          {% for property in concept.properties %} {# loop through ConceptProperty objects #}
            <tr><td><span class="property-click versal{% if property.type == 'rdf:type' %}-bold{% endif %}" >{{ property.label|upper }}<img class='property-hover' src="{{ path_fix }}resource/pics/info.gif"><span class="versal property-mouseover" title="{{ property.description }}"></span></span></td><td><ul>
            {% for propval in property.values %} {# loop through ConceptPropertyValue objects #}
                {% if propval.uri and propval.type != 'rdf:type' %} {# resources with URI #}
                <li>
                  {% if propval.label %}
                    {% if propval.exvocab and propval.exvocab != propval.vocab %}{# if the property is located in a another vocabulary #}
                    <a class="versal" href="{% if propval.type == "onki:memberOf" %}{{ propval.uri | link_url(propval.vocab, lang, 'groups') }}{% else %}{{ propval.uri | link_url(propval.vocab, propval.lang) }}{% endif %}">{{ propval.label }}</a>
                    {% else %}
                      <a class="versal" href="{{ propval.uri | link_url(propval.vocab, lang) }}">{{ propval.label|trans }}</a>
                      {% if propval.lang and propval.lang != lang %}<span class="propertyvalue"> ({{ propval.lang }})</span>{% endif %}
                    {% endif %}
                    {% if propval.SubMembers %}<div class="subvalue"> {# if property is a group concept that has sub properties #}
                      {% for sub_member in propval.SubMembers %}
                        <a class="propertyvalue" href="{{ sub_member.uri | link_url(propval.vocab,lang) }}">{{ sub_member.label }}</a>
                        {% if sub_member.lang and sub_member.lang != lang %}<span class="propertyvalue"> ({{ sub_member.lang }})</span>{% endif %}
                        <br />
                      {% endfor %}
                      </div>
                    {% endif %}
                  {% endif %}
                {% elseif property.type == 'rdf:type' %}<p>{{ propval.label|trans }}</p>
                {% else %} {# Literals (no URI), eg. alternative labels as properties #}
                    <li><p>{{ propval.label }}</p>
                {% endif %}</li>
            {% endfor %}
            </ul></td></tr>
          {% endfor %}
          {% if concept.foreignPrefLabels or concept.foreignAltLabels %}<tr><td><span class="versal property-click">{{ 'foreign prefLabels'|trans|upper }}<img class='property-hover' src="{{ path_fix }}resource/pics/info.gif"><span class="versal property-mouseover" title="{% trans "foreign prefLabel help" %}"></span></td><td>
              <ul>
              {% for lang,labels in concept.foreignPrefLabels %}
                {% for label in labels %}
                  <li><p>{{ label }} ({{ lang }})</p></li>
                {% endfor %}
              {% endfor %}
              {% for lang,labels in concept.foreignAltLabels %}
                {% for label in labels %}
                  <li><p>{{ label }} ({% if lang %}{{ lang }}, {% endif %}{% trans "replaced" %})</p></li>
                {% endfor %}
              {% endfor %}
              </ul></td></tr>
          {% endif %}
            <tr><td><span class="versal">URI</span></td>
            <td><span class="versal uri-input-box">{{ concept.uri }}</span></tr>
            <tr><td><span class="versal">{% trans %}Download this concept in SKOS format:{% endtrans %}

            </span></td><td><span class="versal"><a href="{{ path_fix }}rest/v1/{% if concept.vocab != "" %}{{ concept.vocab }}{% else %}{{ vocab.id }}{% endif %}/data?uri={{ concept.uri|url_encode }}&amp;format=application/rdf%2Bxml">RDF/XML</a>
              <a href="{{ path_fix }}rest/v1/{% if concept.vocab != "" %}{{ concept.vocab }}{% else %}{{ vocab.id }}{% endif %}/data?uri={{ concept.uri|url_encode }}&amp;format=text/turtle">
                TURTLE</a>
            </span></td></tr>
          </table>
          </div>
          {# umpilisäke #}
          <div class="concept-appendix">
            <table class="table search-results-property-table {% if concept.type == 'skosext:DeprecatedConcept' %} deprecated{% endif %}">
            {% for property in concept.mappingProperties %} {# loop through ConceptProperty objects #}
              <tr><td><span class="versal property-click" >{{ property.label|upper }}<img class='property-hover' src="{{ path_fix }}resource/pics/info.gif"><span class="versal property-mouseover" title="{{ property.description }}"></span></span></td><td><ul>
              {% for propval in property.values %} {# loop through ConceptPropertyValue objects #}
                  {% if propval.uri %} {# resources with URI #}
                  <li>
                    {% if propval.label %}
                      {% if propval.exvocab and propval.exvocab != propval.vocab %}{# if the property is located in a another vocabulary #}
                      <a class="propertyvalue" href="{{ propval.uri | link_url(propval.exvocab, propval.lang) }}">{{ propval.label }}</a> @ {{ propval.exvocab }}
                      {% elseif propval.exvocab == propval.vocab %}
                        <a class="propertyvalue" href="{{ propval.uri | link_url(propval.exvocab, propval.lang) }}">{{ propval.label }}</a>
                      {% else %}{# here the concept hasnt been found in any local vocabulary #}
                        <a class="propertyvalue" href="{{ propval.uri }}">{{ propval.label }}</a>
                      {% endif %}
                      {% if propval.SubMembers %}<div class="subvalue"> {# if property is a group concept that has sub properties #}
                        {% for sub_member in propval.SubMembers %}
                          <a class="propertyvalue" href="{{ sub_member.uri | link_url(propval.vocab,lang) }}">{{ sub_member.label }}</a><br />
                        {% endfor %}
                        </div>
                      {% endif %}
                      {% if propval.lang and propval.lang != lang %}<span class="propertyvalue"> ({{ propval.lang }})</span>{% endif %}
                    {% endif %}
                  {% endif %}</li>
              {% endfor %}
              </ul></td></tr>
            {% endfor %}
            </table>
          </div>
        </div>
        {% endfor %}

    {% else %}
    <div class="alert alert-danger">
      <h4>{% trans %}Error: term "{{ term }}" not found in vocabulary!{% endtrans %}</h4>
    </div>
  	{% endif %}
  {% else %}
    <div class="alert alert-danger">
      <h4>{% trans %}Error: Requested vocabulary "{{ vocab_id }}" not found!{% endtrans %}</h4>
    </div>
  {% endif %}
{% endblock %}
